package com.abaaba.project2.controller;

import com.abaaba.project2.bean.CommentDataSendingListBaseReq;
import com.abaaba.project2.bean.GoodsDataSendingListBaseReq;
import com.abaaba.project2.bean.bo.AdminDeleteCommentInformationBO;
import com.abaaba.project2.bean.bo.AdminGoodsDeleteShoppingInformationBO;
import com.abaaba.project2.bean.vo.*;
import com.abaaba.project2.exceptionhandler.ExceptionControllerAdvice;
import com.abaaba.project2.service.AdminCommentService;
import com.abaaba.project2.service.AdminGoodsService;
import com.abaaba.project2.util.ValidUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import javax.validation.constraints.Max;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@RestController
@RequestMapping("/admin/comment")
public class AdminCommentController {

    @Autowired
    AdminCommentService adminCommentService;

    @RequestMapping("list")
    public BaseRespVo goodsDataSendingList(CommentDataSendingListBaseReq baseReq){
        // GoodsDataSendingListVO goodsDataSendingListVO = new GoodsDataSendingListVO();
        AdminGoodsCommentOfListVO adminGoodsCommentOfListVO = adminCommentService.commentSearchAllList(baseReq);
        BaseRespVo baseRespVo = new BaseRespVo();
        baseRespVo.setErrmsg("成功");
        baseRespVo.setData(adminGoodsCommentOfListVO.getData());
        baseRespVo.setErrno(0);
        return baseRespVo;
    }


    /*删除待定，还缺两个表的删除*/
    @RequestMapping("delete")
    public BaseRespVo adminGoodsDeleteShoppingInformation(@RequestBody AdminDeleteCommentInformationBO adminDeleteCommentInformationBO){
        int code = adminCommentService.deleteCommentInformation(adminDeleteCommentInformationBO);

        if (code == 200){
            return BaseRespVo.ok();
        }
    return BaseRespVo.fail();
    }

    @RequestMapping("detail")
    public AdminGoodsAddShoppingInformationOfGoosListTwoVO adminGoodsUpdateShoppingInformation(Integer id){
          return null;
    }


}
